<template>
  <!--用户信息和搜索导航栏-->
  <div>
    <el-button @click="timestampToTime('1649214987000')">点击换</el-button>
  </div>
</template>
<script>
import request from "../../utils/request";
import {marked} from 'marked'

export default {
  name: "test",
  data: function (){
    return {
      }
  },
  methods: {
    timestampToTime (timestamp) {
  // 时间戳转日期时间--从年到分
  if (timestamp) {
    timestamp = Number(timestamp)
  } else {
    return console.log('没有传入时间戳')
  }
  let date = new Date(timestamp) // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
  let Y = date.getFullYear() + '-'
  let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
  let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate() + '') + ' '
  let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
  let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
  // let s = date.getSeconds()
      console.log(Y + M + D + h + m)
  return Y + M + D + h + m
}
  },  
}
</script>

<style scoped>
.articleContentDiv >>> img{
  display: none;
}
.articleContentDiv >>> h1{
  font-size: 13px;
}
.articleContentDiv >>> h2{
  font-size: 13px;
}
.articleContentDiv >>> h3{
  font-size: 13px;
}
.articleContentDiv >>> h4{
  font-size: 13px;
}
.articleContentDiv >>> h5{
  font-size: 13px;
}
.articleContentDiv >>> h6{
  font-size: 13px;
}
</style>
